<table cellpadding="0" cellspacing="0">
	<tbody>
        <tr>
            <td class="leftside">
           		<?php require_once("menu.php");?>
            </td>
            <td class="rightside">
                <div class="box" style="margin-left:10px; margin-right: 10px; float:left;">
                	<div id='title_menu' class="ui-corner-top">Advertisments Management</div>  
                    <div class="content" style="min-height: 150px;">
					<?php
                    	$sql = 'SELECT
								  `positions`.`position_name`,`positions`.`id`,`positions`.`price`, `adsense_bumq`.*
								FROM
								  `adsense_bumq` INNER JOIN
								  `positions` ON `positions`.`id` = `adsense_bumq`.`pisition_id`';
						$q = $db->select_query($sql);
					?>
                    <form action="#" method="post" id="ppc-form">
                      <table class="list">
                        <thead>
                          <tr align="center">
                            <td>ตำแหน่ง</td>
                            <td>ขนาด</td>
                            <td>สถานะ</td>
                            <td>เจ้าของโฆษณา</td>
                            <td width="150">ราคา(บาท)</td>
                          </tr>
                        </thead>
                        <tbody>
                        <?php
						while($rs = $db->fetch($q)){
						?>      
                          <tr>
                          	<td align="center"><?php echo $rs['position_name']; ?></td>
                            <td align="center"><?php echo $rs['size'];?></td>
                            <td align="center">
                            	<select name="status" id="status" ppcid="<?php echo $rs['id'];?>">
                                    <option value="0" <?php ($rs['active']==0)? print 'selected="selected"':'';?>>Unactive</option>
                                    <option value="1" <?php ($rs['active']==1)? print 'selected="selected"':'';?>>Active</option>
                                </select>
                            </td>
                            <td align="center">
                            	<select name="ads_from" id="ads_from" ppcid="<?php echo $rs['id'];?>">
                                	<option value>----- Select ------</option>
                                    <option value="adsense" <?php ($rs['code_from']=='adsense')? print 'selected="selected"':'';?>>Adsense</option>
                                    <option value="bumq" <?php ($rs['code_from']=='bumq')? print 'selected="selected"':'';?>>Bumq</option>
                                    <option value="adyim" <?php ($rs['code_from']=='adyim')? print 'selected="selected"':'';?>>Adyim</option>
                                    <option value="advertisment" <?php ($rs['code_from']=='advertisment')? print 'selected="selected"':'';?>>Advertisment</option>
                                    <option value="banner_125x125" <?php ($rs['code_from']=='banner_125x125')? print 'selected="selected"':'';?>>Banner 125x125</option>
                                    <option value="banner_160x600" <?php ($rs['code_from']=='banner_160x600')? print 'selected="selected"':'';?>>Banner 160x600</option>
                                    <option value="banner_300x250" <?php ($rs['code_from']=='banner_300x250')? print 'selected="selected"':'';?>>Banner 300x250</option>
                                    <option value="banner_728x90" <?php ($rs['code_from']=='banner_728x90')? print 'selected="selected"':'';?>>Banner 728x90</option>
                                </select>
                            </td>
                            <td align="center">
                            <b class="dblclick" id="<?php echo $rs['position_name']; ?>" style="display: inline;color:red;" title="Doubleclick to edit..."><?php echo $rs['price'];?></b>
                            </td>
                          </tr>
                        <?php } ?> 
                        </tbody>
                      </table>
					</form>
                    
                  </div>
                </div>            
            </td>
        </tr>
   	</tbody>
</table>
<script type="text/javascript">
	$(".dblclick").editable("admin_query.php", { 
      /*indicator : "<img src='img/indicator.gif'>",*/
	  id   : 'dblclick',
	  indicator	: 'กำลังบันทึก...',
      tooltip   : "Doubleclick to edit...",
      event     : "dblclick",
      style  : "inherit"
  	});
</script>